#!/user/bin/env node

const fs = require('fs'),
      log = console.log,
      err = console.error,
      exit = process.exit,
      file = process.argv[2];


if(!fs.existsSync(file)){
  log(`${file} not exist`);
  exit(1);
}

log(file.__dirname);
let s = fs.watch(file,log);
log('读取成功');
log(s);

//s.on('data',(data,err)=>{
//  if(data === 'kill -2 pid'){
//    exit(2);
//  }
//})


//setTimeout(()=>{
//  log('18-watch.js will end');
//  exit(1);
//},5000)
